//
//  RegistView.m
//  BasketballClub
//
//  Created by 孙鸿吉 on 16/1/14.
//  Copyright © 2016年 孙鸿吉. All rights reserved.
//

#import "RegistView.h"
@interface RegistView()
@end
@implementation RegistView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self allViews];
    }
    return self;
}
- (void)allViews
{
    //标题
    self.title = [[UILabel alloc]initWithFrame:CGRectMake(SCREEN_WIDTH/2 - (40 * LAYOUT_SIZE), 29 * LAYOUT_SIZE_HEIGHT, 80* LAYOUT_SIZE, 26 * LAYOUT_SIZE_HEIGHT)];
    self.title.text = @"注册账号";
    self.title.textAlignment = 1;
    self.title.textColor = [UIColor yellowColor];
    self.title.font = [UIFont systemFontOfSize:17 * LAYOUT_SIZE];
    [self addSubview:self.title];
    //取消按钮
    self.cancleButton = [[UIButton alloc]initWithFrame:CGRectMake(10 * LAYOUT_SIZE, 29 * LAYOUT_SIZE_HEIGHT, 50 * LAYOUT_SIZE, 26 * LAYOUT_SIZE_HEIGHT)];
    [self.cancleButton setImage:[UIImage imageNamed:@"fanhui"] forState:UIControlStateNormal];
    [self addSubview:self.cancleButton];
    
    //账户
    self.userHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(50 * LAYOUT_SIZE, 150 * LAYOUT_SIZE_HEIGHT, 30 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.userHeadImageView.image = [UIImage imageNamed:@"phoneNumberBackGround@2x"];
    [self addSubview:self.userHeadImageView];
    
    self.userFootImageView = [[UIImageView alloc]initWithFrame:CGRectMake(85 * LAYOUT_SIZE, 150 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 135 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.userFootImageView.image = [UIImage imageNamed:@"phoneNumberBackGroundInput@2x"];
    [self addSubview:self.userFootImageView];
    
    self.errorButton1 = [[UIButton alloc]initWithFrame:CGRectMake(370 * LAYOUT_SIZE, 155 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.errorButton1.hidden = YES;
    [self addSubview:self.errorButton1];
    
    self.errorImageView1 = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH, 120 * LAYOUT_SIZE_HEIGHT, 80 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.errorImageView1.image = [UIImage imageNamed:@"username"];
    [self addSubview:self.errorImageView1];
    
    self.peopleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(55 * LAYOUT_SIZE, 155 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.peopleImageView.image = [UIImage imageNamed:@"iconfont-ren1"];
    [self addSubview:self.peopleImageView];
    
    self.usernameTF = [[UITextField alloc]initWithFrame:CGRectMake(90 * LAYOUT_SIZE, 150 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 145 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.usernameTF.placeholder = @"账号";
    [self.usernameTF setValue:[UIFont boldSystemFontOfSize:16 * LAYOUT_SIZE] forKeyPath:@"_placeholderLabel.font"];
    self.usernameTF.clearButtonMode = 3;
    self.usernameTF.tag = 1001;
    [self.usernameTF setValue:ColorHexA(0xFFFFE0, 0.7) forKeyPath:@"_placeholderLabel.textColor"];
    [self addSubview:self.usernameTF];
    
    //密码
    
    self.passHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(50 * LAYOUT_SIZE, 200 * LAYOUT_SIZE_HEIGHT, 30 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.passHeadImageView.image = [UIImage imageNamed:@"phoneNumberBackGround@2x"];
    [self addSubview:self.passHeadImageView]; 
    
    self.passFootImageView = [[UIImageView alloc]initWithFrame:CGRectMake(85 * LAYOUT_SIZE, 200 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 135 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.passFootImageView.image = [UIImage imageNamed:@"phoneNumberBackGroundInput@2x"];
    [self addSubview:self.passFootImageView];
    
    self.errorButton2 = [[UIButton alloc]initWithFrame:CGRectMake(370 * LAYOUT_SIZE, 205 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.errorButton2.hidden = YES;
    [self addSubview:self.errorButton2];
    
    self.errorImageView2 = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH, 175 * LAYOUT_SIZE_HEIGHT, 80 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.errorImageView2.image = [UIImage imageNamed:@"password"];
    [self addSubview:self.errorImageView2];
    
    self.keyImageView = [[UIImageView alloc]initWithFrame:CGRectMake(55 * LAYOUT_SIZE, 205 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.keyImageView.image = [UIImage imageNamed:@"iconfont-michi"];
    [self addSubview:self.keyImageView];
    
    self.passwordTF = [[UITextField alloc]initWithFrame:CGRectMake(90 * LAYOUT_SIZE, 200 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 145 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.passwordTF.placeholder = @"密码";
    self.passwordTF.secureTextEntry = YES;
    self.passwordTF.clearButtonMode = 3;
    self.passwordTF.tag = 1002;
    [self.passwordTF setValue:[UIFont boldSystemFontOfSize:16 * LAYOUT_SIZE] forKeyPath:@"_placeholderLabel.font"];
    [self.passwordTF setValue:ColorHexA(0xFFFFE0, 0.7) forKeyPath:@"_placeholderLabel.textColor"];
    [self addSubview:self.passwordTF];
    
    //重复密码
    self.RePassHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(50 * LAYOUT_SIZE, 250 * LAYOUT_SIZE_HEIGHT, 30 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.RePassHeadImageView.image = [UIImage imageNamed:@"phoneNumberBackGround@2x"];
    [self addSubview:self.RePassHeadImageView];
    
    self.RepassFootImageView = [[UIImageView alloc]initWithFrame:CGRectMake(85 * LAYOUT_SIZE, 250 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 135 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.RepassFootImageView.image = [UIImage imageNamed:@"phoneNumberBackGroundInput@2x"];
    [self addSubview:self.RepassFootImageView];
    
    self.errorButton3 = [[UIButton alloc]initWithFrame:CGRectMake(370 * LAYOUT_SIZE, 255 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.errorButton3.hidden = YES;
    [self addSubview:self.errorButton3];
    
    self.errorImageView3 = [[UIImageView alloc]initWithFrame:CGRectMake(SCREEN_WIDTH, 225 * LAYOUT_SIZE_HEIGHT, 80 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.errorImageView3.image = [UIImage imageNamed:@"repassword"];
    [self addSubview:self.errorImageView3];
    
    self.reKeyImageView = [[UIImageView alloc]initWithFrame:CGRectMake(55 * LAYOUT_SIZE, 255 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.reKeyImageView.image = [UIImage imageNamed:@"iconfont-michi"];
    [self addSubview:self.reKeyImageView];
    
    self.rePasswordTF = [[UITextField alloc]initWithFrame:CGRectMake(90 * LAYOUT_SIZE, 250 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 145 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.rePasswordTF.placeholder = @"确认密码";
    self.rePasswordTF.secureTextEntry = YES;
    self.rePasswordTF.clearButtonMode = 3;
    self.rePasswordTF.tag = 1003;
    [self.rePasswordTF setValue:[UIFont boldSystemFontOfSize:16 * LAYOUT_SIZE] forKeyPath:@"_placeholderLabel.font"];
    [self.rePasswordTF setValue:ColorHexA(0xFFFFE0, 0.7) forKeyPath:@"_placeholderLabel.textColor"];
    [self addSubview:self.rePasswordTF];
    
    //邮箱
    self.emailHeadImageView = [[UIImageView alloc]initWithFrame:CGRectMake(50 * LAYOUT_SIZE, 300 * LAYOUT_SIZE_HEIGHT, 30 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.emailHeadImageView.image = [UIImage imageNamed:@"phoneNumberBackGround@2x"];
    [self addSubview:self.emailHeadImageView];
    
    self.emailFootImageView = [[UIImageView alloc]initWithFrame:CGRectMake(85 * LAYOUT_SIZE, 300 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 135 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.emailFootImageView.image = [UIImage imageNamed:@"phoneNumberBackGroundInput@2x"];
    [self addSubview:self.emailFootImageView];
    
    self.emailImageView = [[UIImageView alloc]initWithFrame:CGRectMake(55 * LAYOUT_SIZE, 305 * LAYOUT_SIZE_HEIGHT, 20 * LAYOUT_SIZE, 20 * LAYOUT_SIZE_HEIGHT)];
    self.emailImageView.image = [UIImage imageNamed:@"iconfont-youxiang"];
    [self addSubview:self.emailImageView];
    
    self.emailTF = [[UITextField alloc]initWithFrame:CGRectMake(90 * LAYOUT_SIZE, 300 * LAYOUT_SIZE_HEIGHT, SCREEN_WIDTH - 145 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    self.emailTF.placeholder = @"邮箱";
    self.emailTF.clearButtonMode = 3;
    self.emailTF.tag = 1004;
    [self.emailTF setValue:[UIFont boldSystemFontOfSize:16 * LAYOUT_SIZE] forKeyPath:@"_placeholderLabel.font"];
    [self.emailTF setValue:ColorHexA(0xFFFFE0, 0.7) forKeyPath:@"_placeholderLabel.textColor"];
    [self addSubview:self.emailTF];

    //注册按钮
    self.registButton = [[UIButton alloc]initWithFrame:CGRectMake(50 * LAYOUT_SIZE, 380 * LAYOUT_SIZE_HEIGHT, 314 * LAYOUT_SIZE, 30 * LAYOUT_SIZE_HEIGHT)];
    [self.registButton setTitle:@"注册" forState:UIControlStateNormal];
    self.registButton.backgroundColor = ColorHex(0x90EE90);
    self.registButton.layer.masksToBounds = YES;
    self.registButton.layer.cornerRadius = 8;
    [self addSubview:self.registButton];
    
    //logo
    self.logoImageView = [[UIImageView alloc]initWithFrame:CGRectMake((SCREEN_WIDTH - 220*LAYOUT_SIZE)/2, 500 * LAYOUT_SIZE_HEIGHT, 220 * LAYOUT_SIZE, 25 * LAYOUT_SIZE_HEIGHT)];
    self.logoImageView.image = [UIImage imageNamed:@"logo1"];
    [self addSubview:self.logoImageView];
    
}


@end
